//初始患者信息显示区域
function initPatientInfoTable(patientInfo){
	if(patientInfo){
		patientInfo.admission_time=$.dateFormatToString(new Date(patientInfo.admission_time),'yyyy-MM-dd');
		$('#patientInfo_table').find('span').each(function(index,item){
			var bindname = $(item).attr('bindname');
			if(bindname){
				$(item).html(transItemCode(bindname,patientInfo[bindname]));
			}
		})
	}
	
	//显示一体化视图
	showPatientView(patientInfo);
}

//初始化表单项
function initPatientInfoForm(patientInfo){
	$('#patientInfoForm').validation();
	initDatePickers();
	if(patientInfo){
		$('#patientInfoForm').bindData(patientInfo);
		//初始化性别下拉框
		genDictSelect('sexInfo','sex',patientInfo.sex);
		//初始化年龄单位下拉框
		genDictSelect('ageunitInfo','ageunit',patientInfo.ageunit);
		genDictSelect('marryType','marital_status',patientInfo.marital_status);
		genDictSelect('medicalType','medical_type',patientInfo.medical_type);
		genDictSelect('visitingType','visiting_type',patientInfo.visiting_type);
		genDictSelect('nationCode','nation',patientInfo.nation);
		genDictSelect('nationalityCode','nationality',patientInfo.nationality);
	}else{
		//初始化性别下拉框
		genDictSelect('sexInfo','sex','1');
		//初始化年龄单位下拉框
		genDictSelect('ageunitInfo','ageunit','1');
		genDictSelect('marryType','marital_status','1');
		genDictSelect('medicalType','medical_type','1');
		genDictSelect('visitingType','visiting_type','1');
		genDictSelect('nationCode','nation','1');
		genDictSelect('nationalityCode','nationality','1');
	}
}

//显示一体化视图
function showPatientView(patientInfo){
	var patientViewUrl = path+'/page/business/patientview/index?patientId='+patientInfo.patient_code;
//	var patientViewUrl = path+'/page/patientview/index?patientId=12345678';
	$('#showPatientView').click(function(){
		window.parent.open(patientViewUrl,"_blank");
	})
}